import { defineComponent } from "vue";
import style from "./index.module.less";
import PageTitle from "@/components/PageTitle";
import ListView from "@/components/ListView";
import CardView from "@/components/CardView";
import GoodsListItem from "@/components/GoodsListItem";
import Text from "@/components/Text";
import { getSize, getUserInfoUrl, phoneClick } from "@/command/apiTool";
import { Divider } from "vant";
import { useRoute, useRouter } from "vue-router";
export default defineComponent({
  name: "",
  setup() {
    const route = useRoute();
    const router = useRouter();
    const renderItem = (e: any) => {
      return (
        <div onClick={() => router.push(`/deviceDetails?id=${e.id}`)}>
          <GoodsListItem
            class="device-list-item"
            title={e.name}
            img={e.img}
            v-slots={{
              rightBody: () => <Text>{e.remark}</Text>,
            }}
          />
          <Divider />
        </div>
      );
    };
    return () => {
      return (
        <PageTitle title="设备列表">
          <CardView class="!mt-[10px]" radius={0}>
            {/* <ListView renderItem={renderItem} /> */}
            <ListView
              {...getUserInfoUrl(
                {
                  dh: "",
                  xh: "/api/h5/richInspection/small/queryEquipmentList",
                },
                {
                  id: route.query.id,
                }
              )}
              type="list"
              renderItem={renderItem}
              class="mx-[10px] box-border"
            />
          </CardView>
        </PageTitle>
      );
    };
  },
});
